New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

execcommand-copy

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

execcommand-copy

Copy text into a clipboard with JavaScript and execCommand

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
108
increased by25.58%
Maintainers
2
Weekly downloads
 
Created
Source

execcommand-copy

Copy text to a user's clipboard using the modern execCommand interface. This uses the same browser API - document.execCommand as the much-hyped clipboard.js, but doesn't involve itself in the DOM or event binding.

API

available

Detect whether a browser supports the execCommand interface for copying text.

Returns boolean whether the browser support text

copy

Copy a snippet of text to a user's pasteboard if the user has proper browser support.

Parameters

  • text string text snippet

Examples

// using browser events with a click
var eCopy = require('execcommand-copy');
var a = document.getElementById('mybutton');
a.addEventListener('click', function() {
 eCopy.copy(this.innerHTML);
});

Returns boolean whether the text was copied

Keywords

FAQs

Package last updated on 23 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc